import { S } from '../../s';
import { IPSAppDEAction } from '../../app/dataentity/ipsapp-deaction';
import { IPSAppDEDataSet } from '../../app/dataentity/ipsapp-dedata-set';
import { IPSAppDEField } from '../../app/dataentity/ipsapp-defield';
import { IPSAppDataEntity } from '../../app/dataentity/ipsapp-data-entity';
import { IPSDETreeDataSetNode } from './ipsdetree-data-set-node';
import { PSDETreeNodeImplBase } from './psdetree-node-impl-base';
import { IPSDEOPPriv } from '../../dataentity/priv/ipsdeoppriv';

export class PSDETreeDataSetNodeImpl
  extends PSDETreeNodeImplBase
  implements IPSDETreeDataSetNode
{
  protected childcntpsappdefield: IPSAppDEField;
  getChildCntPSAppDEField(): IPSAppDEField | null {
    if (this.childcntpsappdefield != null) return this.childcntpsappdefield;
    const value = this.M.getChildCntPSAppDEField;
    if (value == null) {
      return;
    }
    const ipsappdataentity = this.getPSAppDataEntity();
    if (ipsappdataentity != null) {
      this.childcntpsappdefield = ipsappdataentity.findPSAppDEField(value);
    }
    return this.childcntpsappdefield;
  }

  protected clspsappdefield: IPSAppDEField;
  getClsPSAppDEField(): IPSAppDEField | null {
    if (this.clspsappdefield != null) return this.clspsappdefield;
    const value = this.M.getClsPSAppDEField;
    if (value == null) {
      return;
    }
    const ipsappdataentity = this.getPSAppDataEntity();
    if (ipsappdataentity != null) {
      this.clspsappdefield = ipsappdataentity.findPSAppDEField(value);
    }
    return this.clspsappdefield;
  }

  get customCond(): string {
    return this.M.customCond;
  }

  protected filterpsappdedataset: IPSAppDEDataSet;
  getFilterPSAppDEDataSet(): IPSAppDEDataSet | null {
    if (this.filterpsappdedataset != null) return this.filterpsappdedataset;
    const value = this.M.getFilterPSAppDEDataSet;
    if (value == null) {
      return;
    }
    const ipsappdataentity = this.getPSAppDataEntity();
    if (ipsappdataentity != null) {
      this.filterpsappdedataset = ipsappdataentity.findPSAppDEDataSet(value);
    }
    return this.filterpsappdedataset;
  }

  protected iconpsappdefield: IPSAppDEField;
  getIconPSAppDEField(): IPSAppDEField | null {
    if (this.iconpsappdefield != null) return this.iconpsappdefield;
    const value = this.M.getIconPSAppDEField;
    if (value == null) {
      return;
    }
    const ipsappdataentity = this.getPSAppDataEntity();
    if (ipsappdataentity != null) {
      this.iconpsappdefield = ipsappdataentity.findPSAppDEField(value);
    }
    return this.iconpsappdefield;
  }

  protected idpsappdefield: IPSAppDEField;
  getIdPSAppDEField(): IPSAppDEField | null {
    if (this.idpsappdefield != null) return this.idpsappdefield;
    const value = this.M.getIdPSAppDEField;
    if (value == null) {
      return;
    }
    const ipsappdataentity = this.getPSAppDataEntity();
    if (ipsappdataentity != null) {
      this.idpsappdefield = ipsappdataentity.findPSAppDEField(value);
    }
    return this.idpsappdefield;
  }

  protected leafflagpsappdefield: IPSAppDEField;
  getLeafFlagPSAppDEField(): IPSAppDEField | null {
    if (this.leafflagpsappdefield != null) return this.leafflagpsappdefield;
    const value = this.M.getLeafFlagPSAppDEField;
    if (value == null) {
      return;
    }
    const ipsappdataentity = this.getPSAppDataEntity();
    if (ipsappdataentity != null) {
      this.leafflagpsappdefield = ipsappdataentity.findPSAppDEField(value);
    }
    return this.leafflagpsappdefield;
  }

  get maxSize(): number {
    return this.M.maxSize;
  }

  protected psappdedataset: IPSAppDEDataSet;
  getPSAppDEDataSet(): IPSAppDEDataSet | null {
    if (this.psappdedataset != null) return this.psappdedataset;
    const value = this.M.getPSAppDEDataSet;
    if (value == null) {
      return;
    }
    const ipsappdataentity = this.getPSAppDataEntity();
    if (ipsappdataentity != null) {
      this.psappdedataset = ipsappdataentity.findPSAppDEDataSet(value);
    }
    return this.psappdedataset;
  }

  protected psappdataentity: IPSAppDataEntity;
  getPSAppDataEntity(): IPSAppDataEntity | null {
    return (
      this.psappdataentity ||
      (this.psappdataentity = this.fillObjectModel(
        S._f,
        this.M.getPSAppDataEntity,
        S._2aa,
      ) as IPSAppDataEntity)
    );
  }

  protected removepsappdeaction: IPSAppDEAction;
  getRemovePSAppDEAction(): IPSAppDEAction | null {
    if (this.removepsappdeaction != null) return this.removepsappdeaction;
    const value = this.M.getRemovePSAppDEAction;
    if (value == null) {
      return;
    }
    const ipsappdataentity = this.getPSAppDataEntity();
    if (ipsappdataentity != null) {
      this.removepsappdeaction = ipsappdataentity.findPSAppDEAction(value);
    }
    return this.removepsappdeaction;
  }

  protected removepsdeoppriv: IPSDEOPPriv;
  getRemovePSDEOPPriv(): IPSDEOPPriv | null {
    return (
      this.removepsdeoppriv ||
      (this.removepsdeoppriv = this.fillObjectModel(
        S._270,
        this.M.getRemovePSDEOPPriv,
        S._30e,
      ) as IPSDEOPPriv)
    );
  }

  get sortDir(): 'ASC' | 'DESC' {
    return this.M.sortDir;
  }

  protected sortpsappdefield: IPSAppDEField;
  getSortPSAppDEField(): IPSAppDEField | null {
    if (this.sortpsappdefield != null) return this.sortpsappdefield;
    const value = this.M.getSortPSAppDEField;
    if (value == null) {
      return;
    }
    const ipsappdataentity = this.getPSAppDataEntity();
    if (ipsappdataentity != null) {
      this.sortpsappdefield = ipsappdataentity.findPSAppDEField(value);
    }
    return this.sortpsappdefield;
  }

  get textFormat(): string {
    return this.M.textFormat;
  }

  protected textpsappdefield: IPSAppDEField;
  getTextPSAppDEField(): IPSAppDEField | null {
    if (this.textpsappdefield != null) return this.textpsappdefield;
    const value = this.M.getTextPSAppDEField;
    if (value == null) {
      return;
    }
    const ipsappdataentity = this.getPSAppDataEntity();
    if (ipsappdataentity != null) {
      this.textpsappdefield = ipsappdataentity.findPSAppDEField(value);
    }
    return this.textpsappdefield;
  }

  protected tipspsappdefield: IPSAppDEField;
  getTipsPSAppDEField(): IPSAppDEField | null {
    if (this.tipspsappdefield != null) return this.tipspsappdefield;
    const value = this.M.getTipsPSAppDEField;
    if (value == null) {
      return;
    }
    const ipsappdataentity = this.getPSAppDataEntity();
    if (ipsappdataentity != null) {
      this.tipspsappdefield = ipsappdataentity.findPSAppDEField(value);
    }
    return this.tipspsappdefield;
  }

  protected updatepsdeoppriv: IPSDEOPPriv;
  getUpdatePSDEOPPriv(): IPSDEOPPriv | null {
    return (
      this.updatepsdeoppriv ||
      (this.updatepsdeoppriv = this.fillObjectModel(
        S._270,
        this.M.getUpdatePSDEOPPriv,
        S._30f,
      ) as IPSDEOPPriv)
    );
  }

  get appendCaption(): boolean {
    return this.M.appendCaption != null ? this.M.appendCaption : false;
  }
  get cls(): string {
    return 'PSDETreeDataSetNodeImpl';
  }
  instanceof(cls: string): boolean {
    if (cls == S._116 || cls == S._1b4) return true;
    return super.instanceof(cls);
  }
}
